package com.lanxiao.cloud.modules.user.application.dto;

import com.lanxiao.cloud.common.core.dto.Dto;
import com.lanxiao.cloud.common.core.enums.SexEnum;
import com.lanxiao.cloud.common.core.enums.StateEnum;
import com.lanxiao.cloud.common.core.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;

/**
 * @author ：qiaoliang
 * @date ：2021-09-14
 */
@ApiModel("分页查询用户信息返回模型")
public class UserPageDto  extends Dto<Long> {
  @ApiModelProperty("部门ID")
  private final String deptId;
  @ApiModelProperty("昵称")
  private final String name;
  @ApiModelProperty("头像")
  private final String portrait;
  @ApiModelProperty("性别")
  private final SexEnum sex;
  @ApiModelProperty("手机号")
  private final String phone;
  @ApiModelProperty("签名")
  private final String autograph;
  @ApiModelProperty("状态")
  private final StateEnum state;
  @ApiModelProperty("注册IP")
  private final String createIp;
  @ApiModelProperty("登录时间")
  private final Date loginTime;
  @ApiModelProperty("创建时间")
  private final Date createTime;
  @ApiModelProperty("修改时间")
  private final Date updateTime;
  @ApiModelProperty("登录IP")
  private final String loginIp;

  public UserPageDto(Long id, String deptId, String name, String portrait,
      SexEnum sex, String phone, String autograph,
      StateEnum state, String createIp, Date loginTime, Date createTime, Date updateTime,
      String loginIp) {
    super(id);
    this.deptId = deptId;
    this.name = name;
    this.portrait = portrait;
    this.sex = sex;
    this.phone = phone;
    this.autograph = autograph;
    this.state = state;
    this.createIp = createIp;
    this.loginTime = loginTime;
    this.createTime = createTime;
    this.updateTime = updateTime;
    this.loginIp = loginIp;
  }

  public String getDeptId() {
    return deptId;
  }

  public String getName() {
    return name;
  }

  public String getPortrait() {
    return portrait;
  }

  public SexEnum getSex() {
    return sex;
  }

  public String getPhone() {
    return StringUtils.isNotBlank(phone)?
        phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"):
        phone;
  }

  public String getAutograph() {
    return autograph;
  }

  public StateEnum getState() {
    return state;
  }

  public String getCreateIp() {
    return createIp;
  }

  public Date getLoginTime() {
    return loginTime;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public Date getUpdateTime() {
    return updateTime;
  }

  public String getLoginIp() {
    return loginIp;
  }
}
